
//
// 130311 - AH - Created.
//

package org.japril.servlet.httpannotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.japril.servlet.HttpRequestParamDef;

/**
 * <p>
 *   Parameter annotation telling how a method parameter maps to a request
 *   parameter. 
 * </p>
 * @author Arne Halvorsen (AH)
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
public @interface HttpRequestParam 
{
  /**
   * <p>
   *   Name of request parameter.
   * </p>
   * @return Name of request parameter.
   */
  String name();
  
  /**
   * <p>
   *   Tells if http request parameter is mandatory.
   * </p>
   * @return {@code true} if is mandatory, {@code false} (default) if is not.
   */
  boolean mandatory() default false;
  
  /**
   * <p>
   *   Form type, see
   *   {@link HttpRequestParamDef#ftype() ftype} property.
   * </p>
   * @return Form type, default is "text".
   */
  String ftype() default "text";
  
  /**
   * <p>
   *   Form value, see
   *   {@link HttpRequestParamDef#fvalue() fvalue} property.
   * </p>
   * @return Value or the empty string (default) if not sat.
   */
  String fvalue() default "";
  
  /**
   * <p>
   *   Values to be selected in a combo box, values are comma separated.
   * </p>
   * @return Comma separated list of options or the empty string (default) if
   *         no options.
   */
  String options() default "";
  
  /**
   * <p>
   *   Description of parameter.
   * </p> 
   * @return Description or the empty string if has none.
   */
  String desc() default "";
  
  /**
   * <p>
   *   Information on parameter.
   * </p> 
   * @return Information or the empty string if has none.
   */
  String info() default "";
  
  /**
   * <p>
   *   Sets size to be used in a form.
   * </p>
   * @return Size or {@code -1} if not specified,
   */
  int size() default -1;
  
  /**
   * <p>
   *   Sets column count to be used in a form.
   * </p>
   * @return Count or {@code -1} if not specified,
   */
  int columns() default -1;
  
  /**
   * <p>
   *   Sets row count to be used in a form.
   * </p>
   * @return Count or {@code -1} if not specified,
   */
  int rows() default -1;
  
}
